package com.RunAndHappy.q779178.server.controller;

import com.RunAndHappy.q779178.server.service.MecMsgService;
import com.RunAndHappy.q779178.server.service.UserService;
import com.RunAndHappy.q779178.utils.OSHIMonitorUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("")
@ResponseBody
public class WatchController {
    ObjectMapper mapper = new ObjectMapper(); // create once, reuse
    @Autowired
    private OSHIMonitorUtil oshiMonitorUtil;
    @Autowired
    private MecMsgService mecMsgService;
    @PostMapping("/watch")
    public String watchResult() throws JsonProcessingException {
        Map<String, Object> mecMsg=mecMsgService.watchService();
        return mapper.writeValueAsString(mecMsg);
    }

}
